from QuantLib import *
Basis = QuantLib.LsmBasisSystem()
Basis = Basis.pathBasisSystem(4,Basis.Monomial)
x = range(0,100)
y = [0 for i in range(100)]
for i in range(len(x)):
    y[i]=max(x[i]-20,0)
LinReg = QuantLib.LinearLeastSquaresRegressionReal(x, y, Basis)
coeffs = LinReg.coefficients()
for i in range(5):
    print(coeffs[i])